package com.gzmu.face.mapper;

import com.gzmu.face.entity.Department;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaobo Yan
 * @since 2020-04-20
 */
@Mapper
public interface DepartmentMapper extends BaseMapper<Department> {
    @Insert("INSERT INTO t_department(name,address,situation,principal,telnum,parent,createtime,updatetime,remark) " +
            "VALUES(#{name},#{address},#{situation},#{principal},#{telnum},#{parent},now(),now(),#{remark}) ON DUPLICATE KEY UPDATE " +
            "name=#{name},address=#{address},situation=#{situation},principal=#{principal},telnum=#{telnum},parent=#{parent}," +
            "updatetime=now(),remark=#{remark}")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer insertDepartment(Department department);
}
